package path

import (
	"fmt"
	"log"
	"os"
	"strings"
)

var (
	Secret  string // 私钥
	PucPath string // 静态资源目录
)

func DirInit() {
	// 获取当前工作目录
	Dir, err := os.Getwd()
	if err != nil {
		log.Fatalf("Failed to get project directory:%v", err)
	}

	// dir := strings.Replace(projectDir, "\\", "/", -1)
	// dir = filepath.Join(dir, "..", "..")

	// 切换到上两级目录
	// err = os.Chdir(dir)
	// if err != nil {
	// 	fmt.Println("Error changing directory:", err)
	// 	return
	// }

	newDir := strings.Replace(Dir, "\\", "/", -1)

	Secret = fmt.Sprintf(newDir+"/%s", "cipher")
	PucPath = fmt.Sprintf(newDir+"/%s", "public")

}
